package com.ibm.spatiotemp.server.framework.processor.dynamodb;

import java.sql.SQLException;

import com.ibm.spatiotemp.server.connections.ConnectionManager;
import com.ibm.spatiotemp.server.connections.DynamodbConnection;
import com.ibm.spatiotemp.server.datasources.DataSource;
import com.ibm.spatiotemp.server.framework.processor.SpatialQueryProcessor;
import com.ibm.spatiotemp.server.framework.request.Request;

public class DynamodbSpatialQueryProcessor extends SpatialQueryProcessor{
	
	private DynamodbProcessor innerprocessor;
	
	public DynamodbSpatialQueryProcessor(DataSource src) {
		super(src);
		try {
			DynamodbConnection conn = 
					(DynamodbConnection) 
					ConnectionManager.GetConnection(src.getConnection_string());
			conn.setRelatedsrc(src);
			innerprocessor = new DynamodbProcessor(conn);
		} catch (SQLException e) {
			logger.error(e);
		}
	}
	
	@Override
	public String handlePositionQuery(Request request) throws Exception {
		return innerprocessor.handlePositionQuery(request);
	}
	@Override
	public String handleTrajectoryQuery(Request request) throws Exception {
		return innerprocessor.handleTrajectoryQuery(request);
	}
	@Override
	public String handleTimeQuery(Request request) throws Exception {
		return innerprocessor.handleFirsttimeQuery(request);
	}
	
	
	
}
